﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Quartz;
using Common.Logging;
using ZX.Web.Message;
using System.Net.Mail;
using System.Net;
using ZX.SYS.Bussiness;
namespace ZX.Message.Jobs
{
    public class MQproccessJob : IJob
    {
        private readonly ILog logger;
        private static  object lockobject=new object();
        public MQproccessJob()
        {
            logger = LogManager.GetLogger(GetType());
        }
        /// <summary>
        /// 执行任务
        /// </summary>
        public virtual void Execute(IJobExecutionContext context)
        {
            string ActionName = "";
            try
            {
                //发送
                logger.Info("[MQproccessJob]:手机发送信息服务开始");
                lock (lockobject)
                {
                    ActionName = "发送信息";
                    (new MQproccess()).AutoSendExe();
                }
                logger.Info("[MQproccessJob]:手机发送信息服务完成.");

                //接收
                logger.Info("[MQproccessJob]:接收手机信息服务开始");
                ActionName = "接收信息";
                (new MQproccess()).AutoRecdExe();
                logger.Info("[MQproccessJob]:接收手机信息服务完成.");
            }
            catch (Exception ex)
            {
                logger.Info(string.Format("[MQproccessJob]:{0}服务异常,原因:{1}.", ActionName, ex.Message));
            }

            
    

        }
    }
}
